<template>
  <div class="found">
    <van-sticky>
      <div class="foundHeader">
        <van-icon name="arrow-left" @click="back" class="backIcon" />
        <h1>失物招领</h1>
        <div></div>
      </div>
    </van-sticky>
    <div class="foundList" v-for="item in list" :key="item.id">
      <h1>{{ item.publishDate }}</h1>
      <div
        class="placeList"
        v-for="item1 in item.metroFoundList"
        :key="item1.id"
        @click="foundDetail(item1.id)"
      >
        <h1>{{ item1.claimPlace }}</h1>
        <p><span>创建时间：</span>{{ item1.createTime }}</p>
        <p><span>发现地方：</span>{{ item1.foundPlace }}</p>
        <p><span>发现时间：</span>{{ item1.foundTime }}</p>
        <img :src="'http://218.7.112.123:10001/' + item1.imgUrl" />
      </div>
    </div>
  </div>
</template>

<script>
import { FoundListApi } from "@/service/metro/metroservice.js";
export default {
  data() {
    return {
      list: [],
    };
  },
  methods: {
    back() {
      this.$router.go(-1);
    },
    async getFoundList() {
      let { data } = await FoundListApi();
      console.log(data);
      if (data.code == 200) {
        this.list = data.data;
      }
    },
    foundDetail(id) {
      this.$router.push({path: '/founddetail', query: {id}})
    }
  },
  created() {
    this.getFoundList();
  },
};
</script>

<style lang="scss" scoped>
.found {
  padding-bottom: 45px;
  .foundHeader {
    background-color: skyblue;
    height: 45px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .backIcon {
      color: #fff;
      font-size: 20px;
    }
    h1 {
      font-size: 20px;
      margin-right: 20px;
      color: #fff;
    }
  }
  .foundList {
    margin-top: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid #000;
    h1 {
      text-align: center;
    }
    .placeList {
      border-bottom: 1px solid #666;
      margin-top: 10px;
      img {
        width: 100px;
      }
    }
  }
}
</style>